.class final Lcom/tendcloud/tenddata/fq;
.super Ljava/lang/Object;


# static fields
.field static a:Z

.field static b:Ljava/lang/String;

.field private static volatile c:Lcom/tendcloud/tenddata/fq;

.field private static k:Ljava/lang/String;

.field private static final v:Ljava/util/zip/CRC32;

.field private static w:Ljava/lang/String;


# instance fields
.field private d:Landroid/os/Handler;

.field private e:Landroid/os/HandlerThread;

.field private f:Ljava/util/List;

.field private g:J

.field private h:Ljava/util/Map;

.field private i:Ljava/lang/StringBuffer;

.field private j:Ljava/lang/StringBuffer;

.field private l:Landroid/net/wifi/WifiManager;

.field private m:Z

.field private n:Z

.field private o:I

.field private p:I

.field private q:Ljava/nio/channels/FileChannel;

.field private final r:Ljava/lang/String;

.field private final s:Ljava/lang/String;

.field private final t:Ljava/lang/String;

.field private final u:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    const/4 v0, 0x0

    sput-object v0, Lcom/tendcloud/tenddata/fq;->c:Lcom/tendcloud/tenddata/fq;

    const/4 v0, 0x1

    sput-boolean v0, Lcom/tendcloud/tenddata/fq;->a:Z

    const-string v0, "v1"

    sput-object v0, Lcom/tendcloud/tenddata/fq;->b:Ljava/lang/String;

    new-instance v0, Ljava/util/zip/CRC32;

    invoke-direct {v0}, Ljava/util/zip/CRC32;-><init>()V

    sput-object v0, Lcom/tendcloud/tenddata/fq;->v:Ljava/util/zip/CRC32;

    const-string v0, ""

    sput-object v0, Lcom/tendcloud/tenddata/fq;->w:Ljava/lang/String;

    return-void
.end method

.method private constructor <init>()V
    .locals 4

    const/4 v2, 0x0

    const/4 v1, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object v1, p0, Lcom/tendcloud/tenddata/fq;->d:Landroid/os/Handler;

    iput-object v1, p0, Lcom/tendcloud/tenddata/fq;->e:Landroid/os/HandlerThread;

    iput-object v1, p0, Lcom/tendcloud/tenddata/fq;->f:Ljava/util/List;

    new-instance v0, Ljava/lang/StringBuffer;

    invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->i:Ljava/lang/StringBuffer;

    new-instance v0, Ljava/lang/StringBuffer;

    invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->j:Ljava/lang/StringBuffer;

    iput-boolean v2, p0, Lcom/tendcloud/tenddata/fq;->m:Z

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/tendcloud/tenddata/fq;->n:Z

    iput v2, p0, Lcom/tendcloud/tenddata/fq;->o:I

    iput v2, p0, Lcom/tendcloud/tenddata/fq;->p:I

    const-string v0, "me.xdrig.com"

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->r:Ljava/lang/String;

    iput-object v1, p0, Lcom/tendcloud/tenddata/fq;->s:Ljava/lang/String;

    const-string v0, "https"

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->t:Ljava/lang/String;

    const-string v0, "https://me.xdrig.com"

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->u:Ljava/lang/String;

    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->h:Ljava/util/Map;

    new-instance v0, Landroid/os/HandlerThread;

    const-string v1, "envHandlerThread"

    invoke-direct {v0, v1}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->e:Landroid/os/HandlerThread;

    iget-object v0, p0, Lcom/tendcloud/tenddata/fq;->e:Landroid/os/HandlerThread;

    invoke-virtual {v0}, Landroid/os/HandlerThread;->start()V

    new-instance v0, Lcom/tendcloud/tenddata/fr;

    iget-object v1, p0, Lcom/tendcloud/tenddata/fq;->e:Landroid/os/HandlerThread;

    invoke-virtual {v1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, p0, v1}, Lcom/tendcloud/tenddata/fr;-><init>(Lcom/tendcloud/tenddata/fq;Landroid/os/Looper;)V

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->d:Landroid/os/Handler;

    const/4 v0, 0x4

    const-wide/16 v2, 0x0

    invoke-direct {p0, v0, v2, v3}, Lcom/tendcloud/tenddata/fq;->a(IJ)V

    return-void
.end method

.method static synthetic a(Lcom/tendcloud/tenddata/fq;I)I
    .locals 0

    iput p1, p0, Lcom/tendcloud/tenddata/fq;->p:I

    return p1
.end method

.method private a([B)I
    .locals 6

    :try_start_0
    sget-object v0, Lcom/tendcloud/tenddata/fq;->v:Ljava/util/zip/CRC32;

    invoke-virtual {v0}, Ljava/util/zip/CRC32;->reset()V

    sget-object v0, Lcom/tendcloud/tenddata/fq;->v:Ljava/util/zip/CRC32;

    invoke-virtual {v0, p1}, Ljava/util/zip/CRC32;->update([B)V

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v0, "https://me.xdrig.com"

    invoke-direct {v3, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "/"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    sget-object v1, Lcom/tendcloud/tenddata/fq;->b:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "/"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    sget-object v1, Lcom/tendcloud/tenddata/fq;->v:Ljava/util/zip/CRC32;

    invoke-virtual {v1}, Ljava/util/zip/CRC32;->getValue()J

    move-result-wide v4

    invoke-static {v4, v5}, Ljava/lang/Long;->toHexString(J)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "me.xdrig.com"

    iget-object v2, p0, Lcom/tendcloud/tenddata/fq;->s:Ljava/lang/String;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    sget-object v4, Lcom/tendcloud/tenddata/fq;->w:Ljava/lang/String;

    move-object v5, p1

    invoke-static/range {v0 .. v5}, Lcom/tendcloud/tenddata/bk;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)Lcom/tendcloud/tenddata/bk$d;

    move-result-object v0

    invoke-virtual {v0}, Lcom/tendcloud/tenddata/bk$d;->a()I
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    move-result v0

    :goto_0
    return v0

    :catch_0
    move-exception v0

    const/16 v0, 0x258

    goto :goto_0
.end method

.method private a(Ljava/lang/String;)J
    .locals 6

    const-wide v2, 0x3ffffffffffe5L

    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v1

    const/4 v0, 0x0

    :goto_0
    if-ge v0, v1, :cond_0

    const-wide/16 v4, 0x83

    mul-long/2addr v2, v4

    invoke-virtual {p1, v0}, Ljava/lang/String;->charAt(I)C

    move-result v4

    int-to-long v4, v4

    add-long/2addr v2, v4

    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_0
    return-wide v2
.end method

.method static a()Lcom/tendcloud/tenddata/fq;
    .locals 2

    sget-object v0, Lcom/tendcloud/tenddata/fq;->c:Lcom/tendcloud/tenddata/fq;

    if-nez v0, :cond_1

    const-class v1, Lcom/tendcloud/tenddata/fq;

    monitor-enter v1

    :try_start_0
    sget-object v0, Lcom/tendcloud/tenddata/fq;->c:Lcom/tendcloud/tenddata/fq;

    if-nez v0, :cond_0

    new-instance v0, Lcom/tendcloud/tenddata/fq;

    invoke-direct {v0}, Lcom/tendcloud/tenddata/fq;-><init>()V

    sput-object v0, Lcom/tendcloud/tenddata/fq;->c:Lcom/tendcloud/tenddata/fq;

    :cond_0
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :cond_1
    sget-object v0, Lcom/tendcloud/tenddata/fq;->c:Lcom/tendcloud/tenddata/fq;

    return-object v0

    :catchall_0
    move-exception v0

    :try_start_1
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v0
.end method

.method private a(Landroid/content/Context;)Ljava/lang/String;
    .locals 1

    const/4 v0, 0x0

    return-object v0
.end method

.method private a(IJ)V
    .locals 2

    invoke-static {}, Landroid/os/Message;->obtain()Landroid/os/Message;

    move-result-object v0

    iput p1, v0, Landroid/os/Message;->what:I

    iget-object v1, p0, Lcom/tendcloud/tenddata/fq;->d:Landroid/os/Handler;

    invoke-virtual {v1, v0, p2, p3}, Landroid/os/Handler;->sendMessageDelayed(Landroid/os/Message;J)Z

    return-void
.end method

.method static synthetic a(Lcom/tendcloud/tenddata/fq;)V
    .locals 0

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->d()V

    return-void
.end method

.method static synthetic a(Lcom/tendcloud/tenddata/fq;Z)Z
    .locals 0

    iput-boolean p1, p0, Lcom/tendcloud/tenddata/fq;->n:Z

    return p1
.end method

.method private static a(Ljava/io/File;)[B
    .locals 8

    const/4 v3, 0x0

    const/4 v0, 0x0

    :try_start_0
    new-instance v2, Ljava/io/FileInputStream;

    invoke-direct {v2, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_3
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :try_start_1
    invoke-virtual {p0}, Ljava/io/File;->length()J
    :try_end_1
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_8
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    move-result-wide v4

    const-wide/32 v6, 0x7fffffff

    cmp-long v1, v4, v6

    if-lez v1, :cond_0

    :try_start_2
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_2
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_5

    :goto_0
    return-object v0

    :cond_0
    long-to-int v1, v4

    :try_start_3
    new-array v1, v1, [B
    :try_end_3
    .catch Ljava/lang/Throwable; {:try_start_3 .. :try_end_3} :catch_8
    .catchall {:try_start_3 .. :try_end_3} :catchall_1

    move v4, v3

    :goto_1
    :try_start_4
    array-length v5, v1

    if-ge v4, v5, :cond_1

    if-ltz v3, :cond_1

    array-length v3, v1

    sub-int/2addr v3, v4

    invoke-virtual {v2, v1, v4, v3}, Ljava/io/InputStream;->read([BII)I
    :try_end_4
    .catch Ljava/lang/Throwable; {:try_start_4 .. :try_end_4} :catch_0
    .catchall {:try_start_4 .. :try_end_4} :catchall_1

    move-result v3

    add-int/2addr v4, v3

    goto :goto_1

    :catch_0
    move-exception v1

    :try_start_5
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_5
    .catch Ljava/lang/Throwable; {:try_start_5 .. :try_end_5} :catch_1

    goto :goto_0

    :catch_1
    move-exception v1

    goto :goto_0

    :cond_1
    :try_start_6
    array-length v3, v1
    :try_end_6
    .catch Ljava/lang/Throwable; {:try_start_6 .. :try_end_6} :catch_8
    .catchall {:try_start_6 .. :try_end_6} :catchall_1

    if-ge v4, v3, :cond_2

    :try_start_7
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_7
    .catch Ljava/lang/Throwable; {:try_start_7 .. :try_end_7} :catch_2

    goto :goto_0

    :catch_2
    move-exception v1

    goto :goto_0

    :cond_2
    :try_start_8
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_8
    .catch Ljava/lang/Throwable; {:try_start_8 .. :try_end_8} :catch_6

    move-object v0, v1

    goto :goto_0

    :catch_3
    move-exception v1

    move-object v1, v0

    :goto_2
    :try_start_9
    invoke-virtual {v1}, Ljava/io/InputStream;->close()V
    :try_end_9
    .catch Ljava/lang/Throwable; {:try_start_9 .. :try_end_9} :catch_4

    goto :goto_0

    :catch_4
    move-exception v1

    goto :goto_0

    :catchall_0
    move-exception v1

    move-object v2, v0

    :goto_3
    :try_start_a
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_a
    .catch Ljava/lang/Throwable; {:try_start_a .. :try_end_a} :catch_7

    throw v1

    :catch_5
    move-exception v1

    goto :goto_0

    :catch_6
    move-exception v1

    goto :goto_0

    :catch_7
    move-exception v1

    goto :goto_0

    :catchall_1
    move-exception v1

    goto :goto_3

    :catch_8
    move-exception v1

    move-object v1, v2

    goto :goto_2
.end method

.method static synthetic b(Lcom/tendcloud/tenddata/fq;)V
    .locals 0

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->k()V

    return-void
.end method

.method private c()V
    .locals 1

    :try_start_0
    iget-object v0, p0, Lcom/tendcloud/tenddata/fq;->q:Ljava/nio/channels/FileChannel;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/tendcloud/tenddata/fq;->q:Ljava/nio/channels/FileChannel;

    invoke-virtual {v0}, Ljava/nio/channels/FileChannel;->tryLock()Ljava/nio/channels/FileLock;

    move-result-object v0

    if-eqz v0, :cond_1

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/tendcloud/tenddata/fq;->m:Z

    :cond_0
    :goto_0
    return-void

    :cond_1
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/tendcloud/tenddata/fq;->m:Z
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method static synthetic c(Lcom/tendcloud/tenddata/fq;)V
    .locals 0

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->j()V

    return-void
.end method

.method private d()V
    .locals 3

    const-wide/16 v0, 0x1388

    :try_start_0
    invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V

    new-instance v0, Ljava/io/File;

    sget-object v1, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getFilesDir()Ljava/io/File;

    move-result-object v1

    const-string v2, "tdlock.txt"

    invoke-direct {v0, v1, v2}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v1

    if-nez v1, :cond_0

    invoke-virtual {v0}, Ljava/io/File;->createNewFile()Z

    :cond_0
    new-instance v1, Ljava/io/RandomAccessFile;

    const-string v2, "rw"

    invoke-direct {v1, v0, v2}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V

    invoke-virtual {v1}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;

    move-result-object v0

    iput-object v0, p0, Lcom/tendcloud/tenddata/fq;->q:Ljava/nio/channels/FileChannel;

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->c()V

    iget-boolean v0, p0, Lcom/tendcloud/tenddata/fq;->m:Z

    if-nez v0, :cond_1

    invoke-virtual {p0}, Lcom/tendcloud/tenddata/fq;->b()V

    :goto_0
    return-void

    :cond_1
    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->e()V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method static synthetic d(Lcom/tendcloud/tenddata/fq;)V
    .locals 0

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->h()V

    return-void
.end method

.method static synthetic e(Lcom/tendcloud/tenddata/fq;)I
    .locals 1

    iget v0, p0, Lcom/tendcloud/tenddata/fq;->p:I

    return v0
.end method

.method private e()V
    .locals 0

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->g()V

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->h()V

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->j()V

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->f()V

    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->k()V

    return-void
.end method

.method private f()V
    .locals 4

    :try_start_0
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    const/16 v1, 0x8

    invoke-static {v1}, Lcom/tendcloud/tenddata/ca;->a(I)Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-static {}, Landroid/net/TrafficStats;->getTotalTxBytes()J

    move-result-wide v2

    const-string v1, "wifiTx"

    invoke-virtual {v0, v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    invoke-static {}, Landroid/net/TrafficStats;->getTotalRxBytes()J

    move-result-wide v2

    const-string v1, "wifiRx"

    invoke-virtual {v0, v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    invoke-static {}, Landroid/net/TrafficStats;->getMobileTxBytes()J

    move-result-wide v2

    const-string v1, "mobileTx"

    invoke-virtual {v0, v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    invoke-static {}, Landroid/net/TrafficStats;->getMobileRxBytes()J

    move-result-wide v2

    const-string v1, "mobileRx"

    invoke-virtual {v0, v1, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    invoke-static {}, Lcom/tendcloud/tenddata/fs;->a()Lcom/tendcloud/tenddata/fs;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/tendcloud/tenddata/fs;->a(Lorg/json/JSONObject;)V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method private g()V
    .locals 3

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    if-eqz v0, :cond_0

    new-instance v0, Landroid/content/IntentFilter;

    invoke-direct {v0}, Landroid/content/IntentFilter;-><init>()V

    const-string v1, "android.intent.action.SCREEN_ON"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    const-string v1, "android.intent.action.SCREEN_OFF"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    const-string v1, "android.intent.action.USER_PRESENT"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    new-instance v1, Lcom/tendcloud/tenddata/fq$b;

    invoke-direct {v1, p0}, Lcom/tendcloud/tenddata/fq$b;-><init>(Lcom/tendcloud/tenddata/fq;)V

    sget-object v2, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    invoke-virtual {v2, v1, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    :cond_0
    return-void
.end method

.method private h()V
    .locals 4
    .annotation build Landroid/annotation/TargetApi;
        value = 0x17
    .end annotation

    const/16 v0, 0x17

    :try_start_0
    invoke-static {v0}, Lcom/tendcloud/tenddata/ca;->a(I)Z
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_1

    move-result v0

    if-eqz v0, :cond_3

    :try_start_1
    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.READ_PHONE_STATE"

    invoke-virtual {v0, v1}, Landroid/content/Context;->checkSelfPermission(Ljava/lang/String;)I

    move-result v0

    if-eqz v0, :cond_1

    const/4 v0, 0x6

    const-wide/32 v2, 0x36ee80

    invoke-direct {p0, v0, v2, v3}, Lcom/tendcloud/tenddata/fq;->a(IJ)V

    :cond_0
    :goto_0
    return-void

    :cond_1
    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_COARSE_LOCATION"

    invoke-virtual {v0, v1}, Landroid/content/Context;->checkSelfPermission(Ljava/lang/String;)I

    move-result v0

    if-eqz v0, :cond_2

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_FINE_LOCATION"

    invoke-virtual {v0, v1}, Landroid/content/Context;->checkSelfPermission(Ljava/lang/String;)I

    move-result v0

    if-eqz v0, :cond_2

    const/4 v0, 0x6

    const-wide/32 v2, 0x36ee80

    invoke-direct {p0, v0, v2, v3}, Lcom/tendcloud/tenddata/fq;->a(IJ)V
    :try_end_1
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    :cond_2
    :goto_1
    :try_start_2
    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->i()V
    :try_end_2
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_1

    goto :goto_0

    :catch_1
    move-exception v0

    goto :goto_0

    :cond_3
    :try_start_3
    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.READ_PHONE_STATE"

    invoke-static {v0, v1}, Lcom/tendcloud/tenddata/ca;->b(Landroid/content/Context;Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_COARSE_LOCATION"

    invoke-static {v0, v1}, Lcom/tendcloud/tenddata/ca;->b(Landroid/content/Context;Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_2

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_FINE_LOCATION"

    invoke-static {v0, v1}, Lcom/tendcloud/tenddata/ca;->b(Landroid/content/Context;Ljava/lang/String;)Z
    :try_end_3
    .catch Ljava/lang/Throwable; {:try_start_3 .. :try_end_3} :catch_2

    move-result v0

    if-nez v0, :cond_2

    goto :goto_0

    :catch_2
    move-exception v0

    goto :goto_1
.end method

.method private i()V
    .locals 3

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    if-eqz v0, :cond_0

    :try_start_0
    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    sget-object v1, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "phone"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/telephony/TelephonyManager;

    invoke-virtual {v0}, Landroid/telephony/TelephonyManager;->getSimState()I

    move-result v1

    const/4 v2, 0x5

    if-ne v1, v2, :cond_0

    invoke-virtual {v0}, Landroid/telephony/TelephonyManager;->getCellLocation()Landroid/telephony/CellLocation;

    new-instance v1, Lcom/tendcloud/tenddata/fq$c;

    invoke-direct {v1, p0}, Lcom/tendcloud/tenddata/fq$c;-><init>(Lcom/tendcloud/tenddata/fq;)V

    const/16 v2, 0x10

    invoke-virtual {v0, v1, v2}, Landroid/telephony/TelephonyManager;->listen(Landroid/telephony/PhoneStateListener;I)V

    invoke-static {}, Landroid/telephony/CellLocation;->requestLocationUpdate()V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method private j()V
    .locals 6
    .annotation build Landroid/annotation/TargetApi;
        value = 0x17
    .end annotation

    sget-boolean v0, Lcom/tendcloud/tenddata/fq;->a:Z

    if-nez v0, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    const/16 v0, 0x17

    invoke-static {v0}, Lcom/tendcloud/tenddata/ca;->a(I)Z

    move-result v0

    if-eqz v0, :cond_b

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_COARSE_LOCATION"

    invoke-virtual {v0, v1}, Landroid/content/Context;->checkSelfPermission(Ljava/lang/String;)I

    move-result v0

    if-eqz v0, :cond_2

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_FINE_LOCATION"

    invoke-virtual {v0, v1}, Landroid/content/Context;->checkSelfPermission(Ljava/lang/String;)I

    move-result v0

    if-nez v0, :cond_0

    :cond_2
    :try_start_0
    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    sget-object v1, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "location"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/location/LocationManager;

    const-string v1, "gps"

    invoke-virtual {v0, v1}, Landroid/location/LocationManager;->isProviderEnabled(Ljava/lang/String;)Z

    move-result v1

    const-string v2, "network"

    invoke-virtual {v0, v2}, Landroid/location/LocationManager;->isProviderEnabled(Ljava/lang/String;)Z

    move-result v2

    if-nez v1, :cond_3

    if-eqz v2, :cond_a

    :cond_3
    const-string v1, "passive"

    invoke-virtual {v0, v1}, Landroid/location/LocationManager;->getLastKnownLocation(Ljava/lang/String;)Landroid/location/Location;

    move-result-object v1

    const/4 v0, 0x0

    sget-boolean v2, Lcom/tendcloud/tenddata/ab;->h:Z

    if-eqz v2, :cond_4

    invoke-static {}, Lcom/tendcloud/tenddata/ew;->b()Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    :cond_4
    if-eqz v1, :cond_a

    :try_start_1
    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2}, Lorg/json/JSONObject;-><init>()V

    const-string v3, "lat"

    invoke-virtual {v1}, Landroid/location/Location;->getLatitude()D

    move-result-wide v4

    invoke-virtual {v2, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    const-string v3, "lng"

    invoke-virtual {v1}, Landroid/location/Location;->getLongitude()D

    move-result-wide v4

    invoke-virtual {v2, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    const-string v3, "ts"

    invoke-virtual {v1}, Landroid/location/Location;->getTime()J

    move-result-wide v4

    invoke-virtual {v2, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const/16 v3, 0x11

    invoke-static {v3}, Lcom/tendcloud/tenddata/ca;->a(I)Z

    move-result v3

    if-eqz v3, :cond_5

    const-string v3, "elapsed"

    invoke-virtual {v1}, Landroid/location/Location;->getElapsedRealtimeNanos()J

    move-result-wide v4

    invoke-virtual {v2, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    :cond_5
    invoke-virtual {v1}, Landroid/location/Location;->hasAltitude()Z

    move-result v3

    if-eqz v3, :cond_6

    const-string v3, "altitude"

    invoke-virtual {v1}, Landroid/location/Location;->getAltitude()D

    move-result-wide v4

    invoke-virtual {v2, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    :cond_6
    invoke-virtual {v1}, Landroid/location/Location;->hasAccuracy()Z

    move-result v3

    if-eqz v3, :cond_7

    const-string v3, "accurate"

    invoke-virtual {v1}, Landroid/location/Location;->getAccuracy()F

    move-result v4

    float-to-double v4, v4

    invoke-virtual {v2, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    :cond_7
    invoke-virtual {v1}, Landroid/location/Location;->hasBearing()Z

    move-result v3

    if-eqz v3, :cond_8

    const-string v3, "bearing"

    invoke-virtual {v1}, Landroid/location/Location;->getBearing()F

    move-result v4

    float-to-double v4, v4

    invoke-virtual {v2, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    :cond_8
    invoke-virtual {v1}, Landroid/location/Location;->hasSpeed()Z

    move-result v3

    if-eqz v3, :cond_9

    const-string v3, "speed"

    invoke-virtual {v1}, Landroid/location/Location;->getSpeed()F

    move-result v4

    float-to-double v4, v4

    invoke-virtual {v2, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    :cond_9
    const-string v3, "provider"

    invoke-virtual {v1}, Landroid/location/Location;->getProvider()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v2, v3, v1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    invoke-static {}, Lcom/tendcloud/tenddata/fs;->a()Lcom/tendcloud/tenddata/fs;

    move-result-object v1

    invoke-virtual {v1, v2, v0}, Lcom/tendcloud/tenddata/fs;->a(Lorg/json/JSONObject;Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_1

    :cond_a
    :goto_1
    const/4 v0, 0x1

    const-wide/32 v2, 0x2bf20

    :try_start_2
    invoke-direct {p0, v0, v2, v3}, Lcom/tendcloud/tenddata/fq;->a(IJ)V
    :try_end_2
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_0

    goto/16 :goto_0

    :catch_0
    move-exception v0

    goto/16 :goto_0

    :cond_b
    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_COARSE_LOCATION"

    invoke-static {v0, v1}, Lcom/tendcloud/tenddata/ca;->b(Landroid/content/Context;Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_2

    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v1, "android.permission.ACCESS_FINE_LOCATION"

    invoke-static {v0, v1}, Lcom/tendcloud/tenddata/ca;->b(Landroid/content/Context;Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_2

    goto/16 :goto_0

    :catch_1
    move-exception v0

    goto :goto_1
.end method

.method private k()V
    .locals 5

    const/4 v1, 0x0

    :try_start_0
    sget-object v0, Lcom/tendcloud/tenddata/ab;->mContext:Landroid/content/Context;

    const-string v2, "connectivity"

    invoke-virtual {v0, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/net/ConnectivityManager;

    invoke-virtual {v0}, Landroid/net/ConnectivityManager;->getActiveNetworkInfo()Landroid/net/NetworkInfo;

    move-result-object v0

    if-eqz v0, :cond_2

    invoke-virtual {v0}, Landroid/net/NetworkInfo;->isAvailable()Z

    move-result v2

    if-eqz v2, :cond_2

    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getType()I

    move-result v2

    const/4 v3, 0x1

    if-ne v2, v3, :cond_3

    invoke-static {}, Lcom/tendcloud/tenddata/fs;->a()Lcom/tendcloud/tenddata/fs;

    move-result-object v0

    invoke-virtual {v0}, Lcom/tendcloud/tenddata/fs;->c()[Ljava/io/File;

    move-result-object v2

    if-eqz v2, :cond_1

    array-length v3, v2

    move v0, v1

    :goto_0
    if-ge v0, v3, :cond_1

    aget-object v1, v2, v0
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_1

    :try_start_1
    invoke-static {v1}, Lcom/tendcloud/tenddata/fq;->a(Ljava/io/File;)[B

    move-result-object v4

    invoke-direct {p0, v4}, Lcom/tendcloud/tenddata/fq;->a([B)I
    :try_end_1
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1} :catch_0
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :try_start_2
    invoke-virtual {v1}, Ljava/io/File;->delete()Z

    :goto_1
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :catch_0
    move-exception v4

    invoke-virtual {v1}, Ljava/io/File;->delete()Z

    goto :goto_1

    :catch_1
    move-exception v0

    :cond_0
    :goto_2
    return-void

    :catchall_0
    move-exception v0

    invoke-virtual {v1}, Ljava/io/File;->delete()Z

    throw v0

    :cond_1
    invoke-static {}, Lcom/tendcloud/tenddata/fs;->a()Lcom/tendcloud/tenddata/fs;

    move-result-object v0

    invoke-virtual {v0}, Lcom/tendcloud/tenddata/fs;->b()[B

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-direct {p0, v0}, Lcom/tendcloud/tenddata/fq;->a([B)I

    move-result v0

    const/16 v1, 0xc8

    if-ne v0, v1, :cond_2

    invoke-static {}, Lcom/tendcloud/tenddata/fs;->a()Lcom/tendcloud/tenddata/fs;

    move-result-object v0

    invoke-virtual {v0}, Lcom/tendcloud/tenddata/fs;->d()V

    :cond_2
    :goto_3
    const/4 v0, 0x0

    const-wide/32 v2, 0x927c0

    invoke-direct {p0, v0, v2, v3}, Lcom/tendcloud/tenddata/fq;->a(IJ)V

    goto :goto_2

    :cond_3
    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getType()I

    move-result v1

    const/16 v2, 0x9

    if-eq v1, v2, :cond_2

    invoke-virtual {v0}, Landroid/net/NetworkInfo;->getType()I
    :try_end_2
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_1

    move-result v0

    if-nez v0, :cond_2

    goto :goto_3
.end method


# virtual methods
.method b()V
    .locals 4

    :try_start_0
    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->c()V

    iget-boolean v0, p0, Lcom/tendcloud/tenddata/fq;->m:Z

    if-nez v0, :cond_0

    const/4 v0, 0x5

    const-wide/32 v2, 0x1b7740

    invoke-direct {p0, v0, v2, v3}, Lcom/tendcloud/tenddata/fq;->a(IJ)V

    :goto_0
    return-void

    :cond_0
    invoke-direct {p0}, Lcom/tendcloud/tenddata/fq;->e()V
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    goto :goto_0
.end method
